<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>大屏九宫格视频 | Jaho’s Blog</title>
    <meta name="generator" content="VuePress 1.8.0">
    <link rel="icon" href="/favicon.ico">
    <link rel="manifest" href="/manifest.json">
    <meta name="description" content="记录日常学习工作">
    
    <link rel="preload" href="/assets/css/0.styles.5b8fe0a4.css" as="style"><link rel="preload" href="/assets/js/app.6514719e.js" as="script"><link rel="preload" href="/assets/js/2.ea114ffb.js" as="script"><link rel="preload" href="/assets/js/50.a8018493.js" as="script"><link rel="preload" href="/assets/js/4.e093c564.js" as="script"><link rel="prefetch" href="/assets/js/10.13203aa5.js"><link rel="prefetch" href="/assets/js/11.099868c4.js"><link rel="prefetch" href="/assets/js/12.c8365e17.js"><link rel="prefetch" href="/assets/js/13.89751e7c.js"><link rel="prefetch" href="/assets/js/14.31f563eb.js"><link rel="prefetch" href="/assets/js/15.08b381b6.js"><link rel="prefetch" href="/assets/js/16.1a3867de.js"><link rel="prefetch" href="/assets/js/17.7dd4e0c6.js"><link rel="prefetch" href="/assets/js/18.907c4597.js"><link rel="prefetch" href="/assets/js/19.fac8aa1a.js"><link rel="prefetch" href="/assets/js/20.73fe0e75.js"><link rel="prefetch" href="/assets/js/21.5c50aa1c.js"><link rel="prefetch" href="/assets/js/22.83d03663.js"><link rel="prefetch" href="/assets/js/23.061e7ac0.js"><link rel="prefetch" href="/assets/js/24.cc7e9011.js"><link rel="prefetch" href="/assets/js/25.fa6c7aef.js"><link rel="prefetch" href="/assets/js/26.39392f70.js"><link rel="prefetch" href="/assets/js/27.204436be.js"><link rel="prefetch" href="/assets/js/28.3f54c157.js"><link rel="prefetch" href="/assets/js/29.799d048c.js"><link rel="prefetch" href="/assets/js/3.6c5d6214.js"><link rel="prefetch" href="/assets/js/30.deed02f3.js"><link rel="prefetch" href="/assets/js/31.5916873b.js"><link rel="prefetch" href="/assets/js/32.b0634144.js"><link rel="prefetch" href="/assets/js/33.734675b8.js"><link rel="prefetch" href="/assets/js/34.20404dc4.js"><link rel="prefetch" href="/assets/js/35.d93b829f.js"><link rel="prefetch" href="/assets/js/36.b0692d8d.js"><link rel="prefetch" href="/assets/js/37.3dffa306.js"><link rel="prefetch" href="/assets/js/38.04649a97.js"><link rel="prefetch" href="/assets/js/39.7dfcdc32.js"><link rel="prefetch" href="/assets/js/40.04914511.js"><link rel="prefetch" href="/assets/js/41.ced85449.js"><link rel="prefetch" href="/assets/js/42.72739213.js"><link rel="prefetch" href="/assets/js/43.de1cff16.js"><link rel="prefetch" href="/assets/js/44.48e301ae.js"><link rel="prefetch" href="/assets/js/45.870a7650.js"><link rel="prefetch" href="/assets/js/46.657f15b8.js"><link rel="prefetch" href="/assets/js/47.3df1bfdb.js"><link rel="prefetch" href="/assets/js/48.f4e4e774.js"><link rel="prefetch" href="/assets/js/49.632bf611.js"><link rel="prefetch" href="/assets/js/5.6531e181.js"><link rel="prefetch" href="/assets/js/51.cb424f59.js"><link rel="prefetch" href="/assets/js/52.a9f595dc.js"><link rel="prefetch" href="/assets/js/53.cf8a9ec0.js"><link rel="prefetch" href="/assets/js/54.46d774a3.js"><link rel="prefetch" href="/assets/js/55.3574f9b8.js"><link rel="prefetch" href="/assets/js/56.baf60ba5.js"><link rel="prefetch" href="/assets/js/57.af42b559.js"><link rel="prefetch" href="/assets/js/58.9300cb59.js"><link rel="prefetch" href="/assets/js/6.00f437ec.js"><link rel="prefetch" href="/assets/js/7.58ac7166.js"><link rel="prefetch" href="/assets/js/8.1b9c5002.js"><link rel="prefetch" href="/assets/js/9.5c076362.js">
    <link rel="stylesheet" href="/assets/css/0.styles.5b8fe0a4.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="Jaho’s Blog" class="logo"> <span class="site-name can-hide">Jaho’s Blog</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/posts/" class="nav-link router-link-active">
  技术博客
</a></div> <a href="https://juejin.cn/user/26836627369806" target="_blank" rel="noopener noreferrer" class="repo-link">
    个人主页
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/posts/" class="nav-link router-link-active">
  技术博客
</a></div> <a href="https://juejin.cn/user/26836627369806" target="_blank" rel="noopener noreferrer" class="repo-link">
    个人主页
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><a href="/posts/" aria-current="page" class="sidebar-link">写在前面</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>工作问题解决</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/posts/项目问题解决/vuevite.html" class="sidebar-link">vue3+vite用proxy解决跨域及proxy原理解析</a></li><li><a href="/posts/项目问题解决/大文件.html" class="sidebar-link">大文件切片上传和断点续传</a></li><li><a href="/posts/项目问题解决/代码优化.html" class="sidebar-link">实际工作中代码优化</a></li><li><a href="/posts/项目问题解决/组件问题.html" class="sidebar-link">解决组件传值问题</a></li><li><a href="/posts/项目问题解决/动态组件.html" class="sidebar-link">动态组件实践</a></li><li><a href="/posts/项目问题解决/大屏.html" class="active sidebar-link">大屏九宫格视频</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/posts/项目问题解决/大屏.html#效果展示" class="sidebar-link">效果展示</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/posts/项目问题解决/大屏.html#全屏实现" class="sidebar-link">全屏实现</a></li><li class="sidebar-sub-header"><a href="/posts/项目问题解决/大屏.html#单元素全屏实现" class="sidebar-link">单元素全屏实现</a></li><li class="sidebar-sub-header"><a href="/posts/项目问题解决/大屏.html#九宫格实现" class="sidebar-link">九宫格实现</a></li></ul></li></ul></li><li><a href="/posts/项目问题解决/滚动.html" class="sidebar-link">Vue中Element表单定位滚动到校验错误位置</a></li><li><a href="/posts/项目问题解决/红绿灯.html" class="sidebar-link">Promise实现动态红绿灯切换</a></li><li><a href="/posts/项目问题解决/懒加载.html" class="sidebar-link">实现元素懒加载</a></li><li><a href="/posts/项目问题解决/小程序组件.html" class="sidebar-link">微信小程序封装组件</a></li><li><a href="/posts/项目问题解决/axios.html" class="sidebar-link">项目中对axios的整体封装</a></li><li><a href="/posts/项目问题解决/docker.html" class="sidebar-link">docker实践(附windows安装下载教程)</a></li><li><a href="/posts/项目问题解决/eltable.html" class="sidebar-link">el-table自定义表头及无数据状态</a></li><li><a href="/posts/项目问题解决/gojs.html" class="sidebar-link">gojs入门学习</a></li><li><a href="/posts/项目问题解决/react踩坑.html" class="sidebar-link">React踩坑</a></li><li><a href="/posts/项目问题解决/小程序踩坑.html" class="sidebar-link">小程序踩坑</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>JavaScript</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Css</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Nodejs</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Vue</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Git</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="大屏九宫格视频"><a href="#大屏九宫格视频" class="header-anchor">#</a> 大屏九宫格视频</h1> <blockquote><p>这几天忙的连更文时间都没有，业务的需求确实最近有点多，搞得我都抽不开身更文(其实是懒)，最近的一个需求是我比较感兴趣的，看上去是一个比较高大上的需求，一开始接到需求的时候还觉得一头雾水不知道怎么做，但经过面向百度编程之后，形成了一个比较清晰的形成思路，实现的效果对于强迫症的话来说真的是太舒服了。</p></blockquote> <p>话不多说，我们开始</p> <p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/cbaf851b47194ed7a5cff0c294069b9e~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>不好意思，拿错了</p> <p><img src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ebbaf0028cf24dd48dd9ef7ca99a285e~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <h2 id="效果展示"><a href="#效果展示" class="header-anchor">#</a> 效果展示</h2> <p><img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a5fb010ce0224153ae0ee34ca71e0efe~tplv-k3u1fbpfcp-watermark.image?" alt="667.gif"></p> <h3 id="全屏实现"><a href="#全屏实现" class="header-anchor">#</a> 全屏实现</h3> <p>我们来看一下MDN的官方文档，我们可以通过以下几个api来切换浏览器的全屏模式</p> <div class="language-js extra-class"><pre class="language-js"><code>document<span class="token punctuation">.</span>fullscreenElement <span class="token comment">//判断是否处于全屏状态</span>
document<span class="token punctuation">.</span>documentElement<span class="token punctuation">.</span><span class="token function">requestFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">//切换到全屏</span>
document<span class="token punctuation">.</span><span class="token function">exitFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token comment">//退出全屏</span>
</code></pre></div><p>根据上面这几个api，我们可以来对浏览器进行全屏切换的控制，这里做了一个简单的小栗子</p> <div class="language-js extra-class"><pre class="language-js"><code>document<span class="token punctuation">.</span><span class="token function-variable function">onclick</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">event</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>document<span class="token punctuation">.</span>fullscreenElement<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        document<span class="token punctuation">.</span><span class="token function">exitFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
        document<span class="token punctuation">.</span>documentElement<span class="token punctuation">.</span><span class="token function">requestFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span>
</code></pre></div><p>点击屏幕的时候判断全屏状态，根据全屏状态来切换全屏模式</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/0e9530dae2924c3f90d5b24c44097309~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/dcf6b415915f47e8bac01afe5c8f8f0a~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <h3 id="单元素全屏实现"><a href="#单元素全屏实现" class="header-anchor">#</a> 单元素全屏实现</h3> <p>但是从上面的代码实现效果来看，我们只是实现了浏览器页面的全屏模式，如果想要实现需求的效果，全屏展示九个视频，那么我们应该如何实现？</p> <p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e270653d222b4335a1970cf02a801837~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p> <p>我再来面向百度编程，从MDN中我们再找到一个api（原谅我基础知识不扎实，原来已经存在现有的api能用我都不知道)
其实上面的api就是讲页面所有元素全屏，我们如果要对单元素全屏，就需要获取对应的元素</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string"> Element.requestFullscreen()  </span><span class="token template-punctuation string">`</span></span> 方法用于发出异步请求使元素进入全屏模式。
</code></pre></div><blockquote><p>请求浏览器（user agent）将特定元素（甚至延伸到它的后代元素）置为全屏模式，隐去屏幕上的浏览器所有 UI 元素，以及其它应用。返回一个 <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise" target="_blank" rel="noopener noreferrer"><code>Promise</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>，并会在全屏模式被激活的时候变成 resolved 状态。</p></blockquote> <p>当然我们需要判断在不同浏览器的兼容性，有些低级版本的浏览器可能不支持分屏，并且不同的浏览器使用的可能也有一点区别</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// 判断各种浏览器</span>
<span class="token keyword">function</span> <span class="token function">launchFullScreen</span><span class="token punctuation">(</span><span class="token parameter">element</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>element<span class="token punctuation">.</span>requestFullscreen<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        element<span class="token punctuation">.</span><span class="token function">requestFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>element<span class="token punctuation">.</span>mozRequestFullScreen<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        element<span class="token punctuation">.</span><span class="token function">mozRequestFullScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>element<span class="token punctuation">.</span>webkitRequestFullScreen<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        element<span class="token punctuation">.</span><span class="token function">webkitRequestFullScreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>element<span class="token punctuation">.</span>msRequestFullscreen<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        element<span class="token punctuation">.</span><span class="token function">msRequestFullscreen</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
    <span class="token keyword">else</span> <span class="token punctuation">{</span>
        wtx<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;当前浏览器不支持部分全屏！&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><h3 id="九宫格实现"><a href="#九宫格实现" class="header-anchor">#</a> 九宫格实现</h3> <div class="language-js extra-class"><pre class="language-js"><code><span class="token operator">&lt;</span>div id<span class="token operator">=</span><span class="token string">&quot;video_list&quot;</span><span class="token operator">&gt;</span>
    <span class="token operator">&lt;</span>div<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span> controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
        <span class="token operator">&lt;</span>video style<span class="token operator">=</span><span class="token string">&quot;height: 100px&quot;</span>  controls<span class="token operator">&gt;</span><span class="token operator">&lt;</span>source  src<span class="token operator">=</span><span class="token string">&quot;&quot;</span> type<span class="token operator">=</span><span class="token string">&quot;video/mp4&quot;</span><span class="token operator">&gt;</span><span class="token operator">&lt;</span><span class="token operator">/</span>video<span class="token operator">&gt;</span>
    <span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
    <span class="token operator">&lt;</span>div<span class="token operator">&gt;</span>底部栏<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
</code></pre></div><p>由于九宫格需要排版，而且我们只能对单元素进行全屏操作，所以我们将九宫格和底部栏放到一个div中，对最外层的div进行操作全屏，排版完成之后，我们其实只是对页面的元素进行了一个放大的操作而已，样式什么都不会改变的。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">function</span> <span class="token function">tochange</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">let</span> list <span class="token operator">=</span> document<span class="token punctuation">.</span><span class="token function">getElementById</span><span class="token punctuation">(</span><span class="token string">'video_list'</span><span class="token punctuation">)</span>
    <span class="token function">launchFullScreen</span><span class="token punctuation">(</span>list<span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</code></pre></div><p>其实这是一个很简单的实现过程，但是九宫格的视频看起来有一种排版很清楚的样子，这里给大家做一个分享，码字不易，觉得有趣的话可以给个赞。</p> <p><img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/42ed9f806193421c9fe8a2be1e483513~tplv-k3u1fbpfcp-watermark.image?" alt="image.png"></p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2023-01-04 10:56:12</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/posts/项目问题解决/动态组件.html" class="prev">
        动态组件实践
      </a></span> <span class="next"><a href="/posts/项目问题解决/滚动.html">
        Vue中Element表单定位滚动到校验错误位置
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----><!----></div></div>
    <script src="/assets/js/app.6514719e.js" defer></script><script src="/assets/js/2.ea114ffb.js" defer></script><script src="/assets/js/50.a8018493.js" defer></script><script src="/assets/js/4.e093c564.js" defer></script>
  </body>
</html>
